from pydantic import BaseModel, field_validator


class CategoriesBean(BaseModel):
    category: str
    name: str
    icon: str

    @field_validator("icon")
    def valite_icon(cls, value: str):
        if not value.endswith(".svg"):
            return FileExistsError("图指扩展名错误")
        return value
